package com.naiterui.ehp.bs.b2c.product.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author zhoupeipei
 * @date 2019-05-17 14:53
 * @since 1.0.0
 */
@Data
@Entity
@NoArgsConstructor
@Table(name = "p_category")
public class Category implements Serializable {
    private static final long serialVersionUID = 8225331950302133356L;
    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;

    /**
     * 上级分类id，为0代表当前分类为一级
     */
    @Column(name = "parent_id")
    private Long parentId;

    /**
     * 分类名
     */
    @Column(name = "name")
    private String name;

    /**
     * 描述
     */
    @Column(name = "description")
    private String description;

    /**
     * 已关联商品数量
     */
    @Column(name = "p_number")
    private Integer pNumber;

    /**
     * 在售商品数量
     */
    @Column(name = "on_sale")
    private Integer onSale;

    /**
     * icon图标
     */
    @Column(name = "icon")
    private String icon;

    /**
     * 创建时间
     */
    @Column(name = "created_at", nullable = false)
    private Date createdAt;

    /**
     * 创建人
     */
    @Column(name = "created_by", nullable = false)
    private String createdBy;

    /**
     * 修改时间
     */
    @Column(name = "changed_at", nullable = false)
    private Date changedAt;

    /**
     * 修改人
     */
    @Column(name = "changed_by", nullable = false)
    private String changedBy;

    /**
     * 乐观锁
     */
    @Version
    @Column(name = "version", nullable = false)
    private Integer version;

}
